@extends('layouts.app')
@section('content')
    <link rel="stylesheet" type="text/css" href="{{ asset('css/admin.css') }}" />
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-2">
                @include('admin.left')
            </div>
            <div class="col-sm-10">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        文章管理
                        <a href="{{ route('admin.articles.create') }}" class="btn pull-right">添加文章</a>
                    </div>
                    <div class="panel-body">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>#</th>
                                <th><i class="glyphicon glyphicon-eye-open"></i> 标题</th>
                                <th>分类</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($articles as $article)
                                <tr>
                                    <td>{{ $article->id }}</td>
                                    <td><a href="{{ url('article', [$article->id]) }}" target="_blank">{{ $article->title }}</a></td>
                                    <td>{{ $article->category->name }}</td>
                                    <td>
                                        <a href="{{ route('admin.articles.edit', [$article->id]) }}"><i class="glyphicon glyphicon-edit"></i></a>
                                        <a href="{{ route('admin.articles.destroy', [$article->id]) }}"><i class="glyphicon glyphicon-trash pull-right"></i></a>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="5">
                                    <div class="pagination" style="text-align:center;">{!! $articles->render() !!}</div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="5"><a href="{{ route('admin.articles.create') }}" class="btn btn-primary pull-right">添加文章</a></td>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection